package com.ttl.bc.ic.stkissue.bean;

import org.displaytag.decorator.TableDecorator;

import com.ttl.bc.stock.request2.bean.BCStkIssue2ShowBean;


public class BCStkIssueDecorator extends TableDecorator {

	public String getBillStatus() {
		
		BCStkIssue2ShowBean obj = (BCStkIssue2ShowBean)getCurrentRowObject();
		int billStatus = obj.getBillStatus();		
		
		if(billStatus==0) {
			return "รอเบิก";
		}else {
			return "จ่ายแล้ว";
		}
				
	}	
	
	public String getMode() {
		
		BCStkIssue2ShowBean obj = (BCStkIssue2ShowBean)getCurrentRowObject();
		String docNo = obj.getDocNo();		
		
//		System.out.println("docNo="+docNo+", viewIndex="+getViewIndex()+",getListIndex()="+getListIndex() );		
		int inPage = getListIndex()/50+1;				
//		String mode = "<center>" +
//		"<a href=\"/ittl/stkissue/stkissue.do?mode=approveShow&docNo="+docNo+"&d-49653-p="+inPage+"\">Approve</a> | "+
//		"Delete | "+
//		"<a href=\"/ittl/StkReq.do?mode=edit&docNo="+docNo+"\">Edit</a>        | "+
//		"<a href=\"/ittl/Report.do?mode=printStockRequest&docNo="+docNo+"\" target=\"_blank\">Print</a>"+
//		"</center>";

		
		String ittl_status = obj.getIttl_status();

		if(ittl_status.equals("0")) {		
			return "<center><a href=\"/ittl/stkissue/stkissue.do?mode=approveShow&docNo="+docNo+
					"&d-49653-p="+inPage+"\">จ่ายของ</a></center>";					
		}else if(ittl_status.equals("1")) {
			return "<center><a href=\"/ittl/stkissue/stkissue.do?mode=approveShowCancel&docNo="+docNo+
					"&d-49653-p="+inPage+"\">ยกเลิกการจ่าย</a></center>";
		}else if(ittl_status.equals("4")) {
			return "<center>ยืนยันรับแล้ว</center>";
		}else if(ittl_status.equals("-1")) {
			return "<center>ยกเลิก</center>";			
		}else {
			return ittl_status;
		}
		
	}
	
	public String getIttl_status() {
		BCStkIssue2ShowBean obj = (BCStkIssue2ShowBean)getCurrentRowObject();
		String ittl_status = obj.getIttl_status();
		if(ittl_status.equals("1")) {
			return "จ่ายแล้ว";
		}else if(ittl_status.equals("0")) {
			return "รอเบิก";
		}else if(ittl_status.equals("-1")) {
			return "ยกเลิก";
		}else if(ittl_status.equals("4")) {
			return "รับแล้ว";			
		}else {
			return "ข้อมูล fields ittl_status ผิด";
		}
		
	}
	
}